package operation;
import book.Book;
import book.BookList;
import java.sql.SQLOutput;
import java.util.Scanner;

public class operationRead implements Ioperation{
    public void work(BookList bookList){
        System.out.println("借阅图书");
        System.out.println("请输入要借阅图书的名字:");
        Scanner in = new Scanner(System.in);
        String name = in.nextLine();
        int currentSize = bookList.getUsesize();
        for (int i = 0; i < currentSize; i++) {
            Book book = bookList.getbook(i);
            if (book.getName().equals(name)) {
                book.setIsBorrow(true);
                System.out.println("借阅成功！");
                return;
            }
        }
        System.out.println("借阅失败！");

    }

}

